﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Flow_GetStepRightToFinish_V2]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Flow_GetStepRightToFinish_V2];
GO
CREATE PROCEDURE [dbo].[sproc_Flow_GetStepRightToFinish_V2]
    @FlowID int,
    @StepID int
AS
BEGIN
SET NOCOUNT ON;

DECLARE @RightToFinish bit;
SELECT @RightToFinish = RightToFinish
    FROM dbo.uds_flow_step
    WHERE
        flow_id = @FlowID
        and step_id = @StepID;

IF ( @@ROWCOUNT = 0 )
    RETURN 0; -- not found!
RETURN @RightToFinish;

END
GO